import PropTypes from 'prop-types';
import React, { memo } from 'react';
import { SectionFooterWrapper } from './style';
import IconMoreArrow from 'src/assets/svg/icon-more-arrow';
import { useNavigate } from 'react-router-dom';

const SectionFooter = memo((props) => {
    const { name } = props
    let showMessage = '显示全部';
    if (name) { 
        showMessage = ` 显示更多${name}房源`
    }
  // 事件处理逻辑：跳转到详情页
  const navigate = useNavigate()
  function moreInfoClickHandle() {
    navigate('/entire')
  }
  return (
      <SectionFooterWrapper $color={ name ? '#00848a' : '#000'}>
      <div className="info" onClick={moreInfoClickHandle}>
        <span className="text">{showMessage} </span>
        <IconMoreArrow />
      </div>
    </SectionFooterWrapper>
  );
});

SectionFooter.propTypes = {
  name: PropTypes.string
};

export default SectionFooter;
